package com.qdxwx.data.service.course;


import com.qdxwx.data.mapper.course.CourseMemberMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * CourseMember接口
 * Qdx NetSchool Platform
 * @author qdxwx
 * @updateTime 2022/5/25
 * @description
 */
@Service
public class CourseMemberServiceImpl implements CourseMemberService {

    @Autowired
    private CourseMemberMapper courseMemberMapper;

    @Override
    public int count(long memberTypeId, int courseId) {
        return courseMemberMapper.countCourseMember(memberTypeId, courseId);
    }

    @Override
    public int insert(long memberTypeId, int courseId) {
        if (count(memberTypeId, courseId) > 0) {
            return 0;
        }
        return courseMemberMapper.insertCourseMember(memberTypeId, courseId);
    }

    @Override
    public int delete(long memberTypeId, int courseId) {
        return courseMemberMapper.deleteCourseMember(memberTypeId, courseId);
    }
}